/**
 * 
 */
package com.redside.dao.hibernate;

import java.util.List;
import java.util.Map;

import com.redside.dao.SurveyDao;
import com.redside.model.survey.Survey;

/**
 * @author <a href="mailto:pchapman@easystreet.net">Peter Chapman</a>
 *
 */
public class SurveyDaoHibernate extends GenericDaoHibernate<Survey, Long> implements
		SurveyDao {

    /**
     * Constructor that sets the entity to Survey.class.
     */
	public SurveyDaoHibernate(){
		super(Survey.class);
	}
	
	/* (non-Javadoc)
	 * @see com.redside.dao.SurveyDao#findByGroupId(java.lang.String)
	 */
	@SuppressWarnings("unchecked")
	public List<Survey> findByGroupId(Long id) {
		return getHibernateTemplate().find("from Survey where id = ?",id);
	}

	/* (non-Javadoc)
	 * @see com.redside.dao.GenericDao#exists(java.io.Serializable)
	 */
	public boolean exists(Long id) {
		// TODO Auto-generated method stub
		return false;
	}

	/* (non-Javadoc)
	 * @see com.redside.dao.GenericDao#findByNamedQuery(java.lang.String, java.util.Map)
	 */
	public List<Survey> findByNamedQuery(String queryName,
			Map<String, Object> queryParams) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see com.redside.dao.GenericDao#get(java.io.Serializable)
	 */
	public Survey get(Long id) {
		return (Survey)getHibernateTemplate().get(Survey.class, id);
	}

	/* (non-Javadoc)
	 * @see com.redside.dao.GenericDao#remove(java.io.Serializable)
	 */
	public void remove(Long id) {
		getHibernateTemplate().delete(get(id));

	}

	/* (non-Javadoc)
	 * @see com.redside.dao.GenericDao#save(java.lang.Object)
	 */
	public Survey save(Survey survey) {
		return (Survey) getHibernateTemplate().merge(survey);
	}

}
